{include file="public/header" /}
<link rel="stylesheet" href="/static/admin/builder/css/base.css" media="all">
<style>
	html {
		background-color: #f2f2f2 !important;
	}
</style>
<body>
<div class="layui-fluid layui-anim-fadein">
	<div class="layui-card">
		<div class="layui-form layui-card-header layuiadmin-card-header-auto">
			<div class="layui-form-item">
				<div class="nav">
					<span style=""><i class="layui-icon"></i> {$nav.s_nav}</span>
				</div>
				<div class="nav_search">
					<form class="layui-form">
						<div class="layui-inline">
							<input class="layui-input" placeholder="会员编号/手机号/昵称筛选" name="keyword" value="<?php echo request()->param('keyword');?>"/>
						</div>
						<div class="layui-inline">
							<input class="layui-input" type="number" placeholder="代数" name="algebra" value="<?php echo request()->param('algebra');?>"/>
						</div>
						<div class="layui-inline">
							<button class="layui-btn layuiadmin-btn-useradmin" lay-submit="" lay-filter="sreach">
								<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
							</button>
							{if $Request.param.keyword}
							<a href="{:url('relation')}" class="layui-btn layui-btn-danger">重置</a>
							{/if}
						</div>

					</form>
				</div>
			</div>
		</div>
		<div class="layui-card-body">

			<div style="padding-bottom: 10px;">

				<a class="layui-btn layui-btn-sm layui-btn-radius" style="background: #17a2b8" onclick="openAllCate($(this));">
					<i class="layui-icon layui-icon-util"></i><span class="show_text">展开</span>
				</a>
			</div>

			<div id="test1" class="demo-tree"></div>
		</div>

	</div>
</div>
</body>
{include file="public/footer" /}
<script>
	layui.use(['tree', 'util'], function(){
		var tree = layui.tree
				,layer = layui.layer
				,util = layui.util
				//模拟数据1
				,data1 = [{
					title: '江西'
					,id: 1
					,children: [{
						title: '南昌'
						,id: 1000
						,children: [{
							title: '青山湖区'
							,id: 10001
						},{
							title: '高新区'
							,id: 10002
						}]
					},{
						title: '九江'
						,id: 1001
					},{
						title: '赣州'
						,id: 1002
					}]
				},{
					title: '广西'
					,id: 2
					,children: [{
						title: '南宁'
						,id: 2000
					},{
						title: '桂林'
						,id: 2001
					}]
				},{
					title: '陕西'
					,id: 3
					,children: [{
						title: '西安'
						,id: 3000
					},{
						title: '延安'
						,id: 3001
					}]
				}];


		//按钮事件
		util.event('lay-demo', {
			getChecked: function(othis){
				var checkedData = tree.getChecked('demoId1'); //获取选中节点的数据

				layer.alert(JSON.stringify(checkedData), {shade:0});
				console.log(checkedData);
			}
			,setChecked: function(){
				tree.setChecked('demoId1', [12, 16]); //勾选指定节点
			}
			,reload: function(){
				//重载实例
				tree.reload('demoId1', {

				});

			}
		});

		//常规用法
		tree.render({
			elem: '#test1' //默认是点击节点可进行收缩
			,data: data1
		});


	});
</script>
</html>